<?php
	class Zend_ArtistController extends Zend_Controller_Action
	{
		public function init()
		{

		}
		/*
		* Add a new artist to the user's profile
		*/
		public function newAction()
		{
			//get all the genres
			$genres = array(
					"Electronic",
					"Country",
					"Rock",
					"R & B",
					"Hip-Hop",
					"Heavy-Metal",
					"Alternative Rock",
					"Christian",
					"Jazz",
					"Pop");

			$this->view->genres = $genres;
		}

		/*
		* Save the Artist entered by the user
		* Save the artist into the system
		*/

		public function saveArtistAction() {
			//Initialize variables
			$artistName = $this->_request->getPost('artistName');
			$genre 		= $this->_request->getPost('genre');
			$rating		= $this->_request->getPost('rating');
			$isFav		= $this->_request->getPost('isFav');
			
			//Override default escape
			$this->view->setEscape('strip_tags'); //Loai bo the html tu chuoi php gui den

			//Zend_Loader::loadClass('Escape');
			require "Escape.php";
			$escapeObj = new Escape();
			$this->view->setEscape(array($escapeObj, "doEnhancedEscape"));
			//Clean up inputs
			$artistName = $this->view->escape($artistName);
			$genre = $this->view->escape($genre);
			$rating = $this->view->escape($rating);
			$isFav = $this->view->escape($isFav);
			//Save the input the dB
		}



		/*
		* Artist Profile
		*/
		public function profileAction()
		{
			
		}

		/*List all the artist in the system*/
		public function listAllArtistAction()
		{

		}

		/*
		* Artist Items a user might be interested in purchasing
		*/

		public function artistaffiliatecontentAction()
		{

		}

		/*
		* Display news for users artist.
		*/
		public function newsAction()
		{
		//Check if the user is logged in
		//Get the user's Id
		//Get the artists. (Example uses static artists)
		$artists = array("Thievery Corporation",
		"The Eagles",
		"Elton John");
		//Set the view variables
		$this->view->artists = $artists;
		//Find the view in our new location
		//$this->view->setScriptPath("<APACHE_HOME>");
		//$this->render("news");
		}
		/*
		* Remove favorite artist..
		*/
		public function removeAction()
		{
		//Check if the user is logged in
		//Get the user's Id
		//Get the user's artists.
		$artists = array(
			array( "name" => "Thievery Corporation", "rating" => 5),
			array("name" => "The Eagles", "rating" => 5),
			array("name" => "Elton John", "rating" => 4)
		);
        
        
		//Set the view variables
		$this->view->totalArtist = count($artists);
		$this->view->artists = $artists;
		}
}
?>